#include <iostream>     // std::cout
#include <tuple>
#include <algorithm>
#include <stdio.h>
#include <string.h>
using namespace std;

class student
{
public:
	student():age(0), score(0), height(0)
	{
		memset(name, 0, sizeof(name));
	}
public:
	int age;
	int score;
	double height;
	char name[64];
};
 
struct compare
{
	bool operator() (const student* __x, const student* __y)
	{
		std::tuple<int, int, double, std::string> t1;
		std::tuple<int, int, double, std::string> t2;
 
		t1 = std::make_tuple(__x->age, __x->score, __x->height, __x->name);
		t2 = std::make_tuple(__y->age, __y->score, __y->height, __y->name);
		int t1_age=get<0>(t1);
		int t2_age=get<0>(t2);
		int t1_score=get<1>(t1);
		int t2_score=get<1>(t2);
		if (t1_age < t2_age &&t1_score>t2_score)
		//if (t1_age > t2_age )
			return true;
		else
			return false;
 
	}
};
 
int main(int argc, char* argv[])
{
	student s1;
	s1.age = 12;
	s1.score = 92;
	s1.height = 54.5;
	strcpy(s1.name, "python");
 
	student s2;
	s2.age = 11;
	s2.score = 89;
	s2.height = 54.5;
	strcpy(s2.name, "hello");
 
	student s3;
	s3.age = 13;
	s3.score = 87;
	s3.height = 54.5;
	strcpy(s3.name, "python");
	
	student s4;
	s4.age = 16;
	s4.score = 99;
	s4.height = 54.5;
	strcpy(s4.name, "python");
	
 
	std::vector<student*> vec;
	vec.push_back(&s1);
	vec.push_back(&s2);
	vec.push_back(&s3);
	vec.push_back(&s4);
 
	std::sort(vec.begin(), vec.end(), compare());
 
 
 
 
//	for(auto record : vec)
//	{
//		cout << "age" << record->age << "score" << record->score << "height" << record->height << "name" << record->name << endl;
//	}
 
 
 for(int i=0;i<vec.size();i++)
 {
	auto record=vec[i];
	 cout << "age" << record->age << "score" << record->score << "height" << record->height << "name" << record->name << endl;
 }
 
	system("pause");
	return 0;
}
